#!/usr/bin/python
import Scripting

bld.add_subdirs('bwt')
lib = bld.static_library('bunjalloo', 'arm9', uselib_local='bwt', install_path=0)
lib.source.remove('arm9/Main.cpp')

host_libs = ''
is_nds = bld.env.variant().startswith('nds')
if is_nds:
    host_libs = 'NDS DSWIFI9 '
else:
    host_libs = 'GL SDL '
    if type(bld.env['USE_PROFILER']) == str:
        host_libs += bld.env['USE_PROFILER']
    host_libs += ' '

host_libs += 'Z PNG JPEG GIF UNZIP MATRIXSSLSTATIC'

prog = bld.program('bunjalloo', 'arm9/Main.cpp',
        uselib_local='bunjalloo',
        install_path=0,
        uselib=host_libs)

if is_nds:
    import ndstool
    bld.create_nds('bunjalloo.nds', 'bunjalloo',
            banner=ndstool.generate_banner('bunjalloo', 'Web Browser'),
            icon='common/data/icon.bmp')
    bld.install_files('${PREFIX}', 'bunjalloo.nds')
    for d in ('config', 'docs', 'fonts', 'cert'):
        bld.install_files(
            '${PREFIX}/data/bunjalloo/%s'%d,
            'data/bunjalloo/%s/*'%d)

if 'check' in Scripting.commands:
    bld.add_subdirs('tests')
